/* util */
import _, { isFunction } from 'lodash';

export default {
  name: 'charts-mixins',
  methods: {
    handlerWindowResize() {
      try {
        if (this.chart) {
          this.chart.resize()
        }
      } catch (error) {
        console.warn(error)
      }
    }
  },
  mounted() {
    window.addEventListener('resize', _.debounce(this.handlerWindowResize));
  },
  beforeDestroy() {
    window.removeEventListener('resize', _.debounce(this.handlerWindowResize));
  },
}